package com.eduadmin.service;

import com.eduadmin.entity.Student;
import com.eduadmin.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class StudentServiceImpl implements IStudentService {

    private final StudentMapper studentMapper ;
    @Autowired
    public StudentServiceImpl(StudentMapper studentMapper){
        this.studentMapper = studentMapper;
    }

    @Override
    public void addStudents(List<Student> students) {
        studentMapper.insertStudents(students);
    }

    @Override
    public Student getStudentByIdcard(String studentIdCard) {
        return studentMapper.selectStudentByIdcard(studentIdCard);
    }

    @Override
    public List<Student> getAllStudents(Map<String, Object> paraMap) {
        return studentMapper.selectAllStudents(paraMap);
    }

    @Override
    public Long getAllTotal(Map<String, Object> paraMap) {
        return studentMapper.selectAllStudentTotal(paraMap);
    }

    @Override
    public int newAddStudent(Student student) {
        return studentMapper.insertStudent(student);
    }

    @Override
    public int editStudent(Student student) {
        return studentMapper.insertORupdateStudent(student);
    }

    @Override
    public int deleteStudent(String studentIdCardString) {
        return studentMapper.deleteStudent(studentIdCardString);
    }
}
